'use strict';
import Base from './base.js';

export default class extends Base{

	// 获取当前机构新增的卡项、产品和项目
	async getaddinfoAction(){
		let orid = this.userinfo.departmentid;
		// 今年时间戳（秒）
		let nowYear = new Date().getFullYear();
		let nowTime = Math.round(new Date(nowYear,0,1).valueOf()/1000);
		// 今年机构新增产品
		let goodslist = await this.model('or_goods').where({departmentid:orid, addtime:['>=', nowTime]}).select();
		// 今年机构新增项目
		let subjectlist = await this.model('or_subject').where({departmentid:orid, addtime:['>=', nowTime]}).select();

		let data = {
			goods : goodslist,
			subjects : subjectlist,
		}

		return this.json(data);
	}
}